package title;

import java.util.Scanner;

/**
 * 功能：
 * 作者：lc
 * 日期：2024/12/1 2:47
 */
public class MainP1425 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        int d = scanner.nextInt();
        System.out.print(b<=d?c-a+" "+(d-b):(c-a-1)+" "+(d-b+60));

    }
}
